package com.zeng.incast.videoplay.hardcode;


import android.view.Surface;
import com.zeng.incast.videoplay.hardcode.AvcDecode;


public class VideoWrapper {

    private static VideoWrapper instanceVideoWrapper;
    private AvcDecode avcDecode;
    private Surface surface;

    public VideoWrapper() { }

    public static VideoWrapper getInstance() {
        if (instanceVideoWrapper == null) {
            instanceVideoWrapper = new VideoWrapper();
        }
        return instanceVideoWrapper;
    }


    public void startDecode() {
        if (avcDecode == null) {
            avcDecode = new AvcDecode(surface);
        }
        if (avcDecode.getStatus()){
            return;
        }
        avcDecode.startDecode();
    }

    public void stopDecode(){
        if (avcDecode != null){
            avcDecode.stopDecode();
        }
        avcDecode = null;
    }

    public void setSurface(Surface surface) {
        this.surface = surface;
    }
    public Surface getSurface() {
        return surface;
    }
    public AvcDecode getAvcDecode() {
        return avcDecode;
    }
    public void setAvcDecode(AvcDecode avcDecode) {
        this.avcDecode = avcDecode;
    }
}

